<% sortable = local_assigns[:sortable] %>
<% frame_name = local_assigns[:frame_name] || controller_name %>

<%= turbo_frame_tag frame_name, autoscroll: true, data: { autoscroll_block: :start, autoscroll_behavior: :smooth, turbo_action: 'advance' } do %>
  <%= render 'spree/admin/shared/export_modal', export_type: export_type if local_assigns[:export_type] %>
  <div class="card-lg">
    <% if lookup_context.template_exists?('filters', lookup_context.prefixes, true) %>
      <%= render 'filters' %>
    <% end %>

    <% if @collection.any? %>
      <div class="<% if lookup_context.template_exists?('filters', lookup_context.prefixes, true) %>with-filters<% end %>" id="listing_<%= controller_name %>">
        <table class="table">
          <thead>
            <%= render 'table_header' %>
          </thead>
          <tbody
            <% if sortable %>
              data-controller="sortable"
              data-sortable-handle-value=".move-handle"
              data-sortable-resource-name-value="<%= controller_name.singularize %>"
              data-sortable-response-kind-value="turbo-stream"
            <% end %>
          >
            <%= render partial: 'table_row', collection: @collection, as: controller_name.singularize %>
          </tbody>
        </table>
      </div>

      <%= render 'spree/admin/shared/index_table_options', collection: @collection %>
    <% else %>
      <%= render 'spree/admin/shared/no_resource_found', new_object_url: (new_object_url if can?(:create, model_class)) %>
    <% end %>
  </div>
<% end %>